package com.ruubypay.web.common.code;

/**
 * Desc : 返回状态码定义
 * @author sucyun
 * Date : 2018/3/12 下午4:14
 */
public enum ResultCode {

	/**
	 * 包含所有公共返回状态码
	 */
	COMMON_SUCCESS("200","操作成功"),
	COMMON_SUCCESS_NO_DATA("201","请求成功,无相关数据"),
	COMMON_SUCCESS_LOGIN_FAILURE("202","用户名或密码错误"),
	COMMON_ERROR_CLIENT_PARAMETER_NUll("400","参数空,或参数缺少必填参数"),
	COMMON_ERROR_CLIENT_PARAMETER_CAST("401","参数解析错误,数据类型不正确"),
	COMMON_ERROR_CLIENT_SIGN("402","签名验证不通过"),
	COMMON_ERROR_CLIENT_BLANK("403","白名单不存在或存在黑名单"),
	COMMON_ERROR_SERVER_NO_DATA("500","接口调用成功数据不存在"),
	COMMON_ERROR_SERVER_DATABASE("501","数据请求失败"),
	COMMON_NO_START_USER("1001","未设置流程发起人"),
	COMMON_NO_PROCESS_KEY("1002","未设置流程key"),
    COMMON_NO_PROCESS_BUSINESS_KEY("1003","未设置业务关联字段"),
    PROCESS_STARTFAIL("1100","流程启动失败"),
	TASK_NO_ID("2000","taskId不能为空"),
	NO_PROCESS_INSTANCE_ID("2002","流程实例Id不能为空"),
    TASK_SUBMIT_FAIL("2004","任务提交失败，可能是因为任务已提交"),
    NO_CLAIM_USER("3000","任务签收人不能为空"),
    TASK_CIALIM_FAIL("3004","任务签收失败。可能是因为任务已被他人签收" ),
	QUERY_PROCESS_INFO_FAIL("4000","查询流程跟踪信息失败"),
    QUERY_OUT_COMING_LINE_FAIL("5000","获取当前连线失败" ),
    TASK_ASSIGNED_NO_USER("6000","任务指派人为空,请输入任务指派人，逗号间隔" ),
    TASK_ASSIGNEE_FAIL("6002", "任务指派失败，可能是因为任务已被他人签收");


	private String code;
	private String msg;

	ResultCode(String code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	public String getCode() {
		return code;
	}

	public String getMsg() {
		return msg;
	}

	public static String getResMessage(String code) {
		for (ResultCode resultCode : ResultCode.values()) {
			if (code.equals(resultCode.getCode())) {
				return resultCode.getMsg();
			}
		}
		return "返回码不存在";
	}
}